%%%-------------------------------------------------------------------
%%% @author Rain
%%% @copyright (C) 2022, <COMPANY>
%%% @doc
%%% @end
%%%-------------------------------------------------------------------
-module(entrace_sup).

-behaviour(supervisor).

-export([start_link/0, init/1, start_child_sup_rank/0]).

start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

init([]) ->
    {ok, {#{strategy => one_for_one,
        intensity => 5,
        period => 30},
        []}
    }.

%% @doc 启动一个rank_sup孩子
start_child_sup_rank() ->
    RankSupChild = #{id => rank_sup,
        start => {rank_sup, start_link, []},
        restart => permanent,
        shutdown => 2000,
        type => supervisor,
        modules => [rank_sup]},
    supervisor:start_child(?MODULE, RankSupChild).
